<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>注册页面</title>
</head>

<script>
    
    function ResCheck() {
        var x=document.forms["Register"]["username"].value;
        if ( x == "" || x == null){
            alert("用户名不能为空!");
            return (false);
        }
    
        var y= document.forms["Register"]["password"].value;
        if (y == "" || y == null){
            alert("密码不能为空!");
            return (false);
        }
        
        var z= document.forms["Register"]["password2"].value;
        if ( z!=y ) {
            alert("两次密码输入不一致，重新输入！");
            return (false);
        }
    }
</script>

<body>
  <div style="position: absolute; left: 25%; top: 25%;width: 1000px; margin-left:-50px; margin-top: -100px; border: 1px dashed; padding: 50px">
    <div>
      <form action="register.php" method="post" name="Register" onsubmit="return ResCheck()">
        <div style="color:black">
          <h2>用户注册</h2>
        </div>
        <div>
          <label>用户名</label>
          <div>
            <input type="text" name="username" id="username" placeholder="用户名" autocomplete="off">
          </div>
        </div>
        <br/>
        <div>
          <label>密码</label>
          <div>
            <input type="password" name="password" id="password" placeholder="密码" autocomplete="off">
          </div>
        </div>
        <br/>
        <div>
          <label>确认密码</label>
          <div>
            <input type="password" name="password2" id="password2" placeholder="再次输入密码" autocomplete="off">
          </div>
        </div>
        <br/>
        <div>
          <input type="submit" value="提交">
        </div>
      </form>   
    </div>  
  </div>
</body>
</html>